Hack Name: Harry Potter School Selection Randomized v1.0

Author: WormHole @ XMB Garage.

Based On school Selection (Randomized) v1.0 by: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Description:
This hack will sort users into a school at random upon registration
It comes with the Harry Potter default options of: Beauxbatons, Durmstrang and Hogwarts.
This hack will show this selection in both profiles and posts.

Supported Version: XMB 1.9.5 Nexus Final

Notes:

This hack is released under the GPL. You should have recieved a copy of it with this hack.

Please backup your files before installing this mod. Neither XMBGarage nor the author can be held 
responsible if your board stops functioning properly due to you installing this hack.

=======================================================================================================

=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

========================================
Paste the following code and hit submit:
========================================

ALTER TABLE `$table_members` ADD `school` INT(1) NOT NULL default 0;
UPDATE `$table_members` SET school=FLOOR(1 + (RAND() * 3)) WHERE status != 'Super Administrator';

=======================================================================================================

=======
Step 2:
=======

===========================
Edit lang/English.lang.php:
===========================

================
Add To End Of File:
================

// School Selection Mod Begin
$lang['schoolselection1'] = "School:";
$lang['schoolselection2'] = "Congratulations! You have been sorted into ";
$lang['schoolselection3'] = "School";
$lang['school1name'] = "Beauxbatons";
$lang['school2name'] = "Durmstrang";
$lang['school3name'] = "Hogwarts";
// School Selection Mod End

=======================================================================================================

=======
Step 3:
=======

============
Edit cp.php:
============

=====
Find:
=====

            <td><strong><font color="<?php echo $cattext?>"><?php echo $lang['textcusstatus']?></font></strong></td>
    
==========
Add Below:
==========

            <td><strong><font color="<?php echo $cattext?>"><?php echo $lang['schoolselection3']?></font></strong></td>
    
=====
Find:
=====

            $sadminselect = "";
            $adminselect = "";
            $smodselect = "";
            $modselect = "";
            $memselect = "";
            $banselect = "";
            $noban = "";
            $u2uban = "";
            $postban = "";
            $bothban = "";
            
==========
Add Below:
==========

            $school1sel = $school2sel = $school3sel = '';
            
=====
Find:
=====

                switch ($member['status']) {
                    case 'Super Administrator':
                        $sadminselect = $selHTML;
                        break;

                    case 'Administrator':
                        $adminselect = $selHTML;
                        break;

                    case 'Super Moderator':
                        $smodselect = $selHTML;
                        break;

                    case 'Moderator':
                        $modselect = $selHTML;
                        break;

                    case 'Member':
                        $memselect = $selHTML;
                        break;

                    case 'Banned':
                        $banselect = $selHTML;
                        break;

                    default:
                        $memselect = $selHTML;
                        break;
                }
                
==========
Add Below:
==========

                switch($member['school']) {
                    case 1:
                        $school1sel = $selHTML;
                        break;
                        
                    case 2:
                        $school2sel = $selHTML;
                        break;
                        
                    case 3:
                        $school3sel = $selHTML;
                        break;
                 }
               
=====
Find:
=====

                <td><input type="text" size="16" name="cusstatus<?php echo $member['uid']?>" value="<?php echo htmlspecialchars(stripslashes($member['customstatus']))?>" /></td>
                
==========
Add Below:
==========

                <td><select name="school<?php echo $member['uid']?>">
                <option value="1" <?php echo $school1sel?>><?php echo $lang['school1name']?></option>
                <option value="2" <?php echo $school2sel?>><?php echo $lang['school2name']?></option>
                <option value="3" <?php echo $school3sel?>><?php echo $lang['school3name']?></option>
                </select></td>
                
=====
Find:
=====

                <?php
                $sadminselect = "";
                $adminselect = "";
                $smodselect = "";
                $modselect = "";
                $memselect = "";
                $banselect = "";
                $noban = "";
                $u2uban = "";
                $postban = "";
                $bothban = "";

==========
Add Below:
==========

                $school1sel = $school2sel = $school3sel = '';
                
=====
Find:
=====

            <td bgcolor="<?php echo $altbg2?>" class="tablerow" align="center" colspan="7"><input type="submit" class="submit" name="membersubmit" value="<?php echo $lang['textsubmitchanges']?>" /><input type="hidden" name="srchmem" value="<?php echo $srchmem?>" /><input type="hidden" name="srchstatus" value="<?php echo $srchstatus?>" /></td>
            
=============
Replace With:
=============

            <td bgcolor="<?php echo $altbg2?>" class="tablerow" align="center" colspan="8"><input type="submit" class="submit" name="membersubmit" value="<?php echo $lang['textsubmitchanges']?>" /><input type="hidden" name="srchmem" value="<?php echo $srchmem?>" /><input type="hidden" name="srchstatus" value="<?php echo $srchstatus?>" /></td>
            
=====
Find:
=====

            $delete = "delete$mem[uid]";
            $delete = "${$delete}";
            
==========
Add Below:
==========

            $school = "school$mem[uid]";
            $school = "${$school}";
            
=====
Find:
=====

                    $db->query("UPDATE $table_members SET ban='$banstatus'
    
========================
Add directly after this:
========================

, school='$school'

=======================================================================================================

=======
Step 4:
=======

================
Edit member.php:
================

=====
Find:
=====

        $db->query("INSERT INTO $table_members (
        
==========
Add Above:
==========

        // School Selection Mod Begin
        $school = rand(1, 4);
        // School Selection Mod End

=====
Find:
=====

        $db->query("INSERT INTO $table_members (
        
=====================================
Add to line just before ') VALUES (':
=====================================

, school

===========================================
Add to end of statement just before ')");':
===========================================

, '$school'

=====
Find:
=====

"<center><span class=\"mediumtxt \">$lang[regged]</span></center>"

=============
Replace With:
=============

"<center><span class=\"mediumtxt \">$lang[regged]<br />$lang[schoolselection2]<strong>".$lang['school'.$school.'name']."</strong></span></center>"

=====
Find:
=====

            if ($memberinfo['showemail'] == "yes") {
                eval("\$emailblock = \"".template("member_profile_email")."\";");
            } else {
                $emailblock = '';
            }
          
==========  
Add Below:
==========

            // school Selection Hack
            if ($memberinfo['school'] != 0) {
                $school = 'school'.$memberinfo['school'].'name';
                $memberinfo['school'] = $lang[$school];
                $memberschool = "<img src=\"images/".$memberinfo['school'].".gif\" border=\"0\" /> ".$memberinfo['school'];
            } else {
                $memberschool = $lang['textnone'];
            }
            // End school Selection Hack

=======================================================================================================

=======
Step 5:
=======

===============
Edit memcp.php:
===============

=====
Find:
=====

    if ($member['mood'] != '') {
        $member['mood'] = censor($member['mood']);
        $member['mood'] = postify($member['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
    } else {
        $member['mood'] = '&nbsp;';
    }
    
==========
Add Below:
==========

    // School Selection Mod Begin
    $school = '';
    if ($member['school'] != 0) {
        $school = 'school'.$member['school'].'name';
        $school = $lang[$school];
    }
    // School Selection Mod End

=======================================================================================================

=======
Step 6:
=======

====================
Edit viewthread.php:
====================

=====
Find:
=====

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }
            
==========
Add Below:
==========

            // School Selection Mod Begin
            $school = '';
            if ($post['school'] != 0) {
                $school = 'school'.$post['school'].'name';
                $post['school'] = $lang[$school];
                $school = "<br />".$lang['schoolselection1']." ".$post['school'];
            }
            // School Selection Mod End
            
=====
Find:
=====

            $location = '';
            $mood = '';
            
==========
Add Below:
==========

            $school = '';

=======================================================================================================

=======
Step 7:
=======

=======================================
Go to Administration Panel -> Templates
=======================================

==============================
Edit Template: member_profile:
==============================

=====
Find:
=====

<tr>
<td bgcolor="$altbg1" class="tablerow" valign="top">$lang[textstatus]<br /><a href="$sitelink" target="_blank">$memberinfo[avatar]</a></td>
<td bgcolor="$altbg2" class="tablerow">$showtitle$customstatus<br />$stars<br /><br />$rank[avatarrank]</td>
</tr>

==========
Add Below:
==========

<tr>
<td bgcolor="$altbg1" class="tablerow" valign="top">$lang[schoolselection1]</td>
<td bgcolor="$altbg2" class="tablerow">$memberschool</td>
</tr>

=======================================================================================================

=======
Step 8:
=======

=======================================
Go to Administration Panel -> Templates
=======================================

==========================
Edit Template: memcp_home:
==========================

=====
Find:
=====

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
</tr>

=============
Replace With:
=============

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">$lang[schoolselection1]</td>
<td bgcolor="$altbg2" valign="top">$school</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
</tr>

=======================================================================================================

=======
Step 9:
=======

=======================================
Go to Administration Panel -> Templates
=======================================

===============================
Edit Template: veiwthread_post:
===============================

=====
Find:
=====

$location

==========
Add Below:
==========

$school

=======================================================================================================

Upload all edited files and enjoy!